import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

/* 基本信息 新增/修改 */
export const add = (row) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/submit',
    method: 'post',
    data: row
  })
}


/* 服务商个人 基本信息/认证和结算卡详情 */
export const getInfoDetail = () => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/info',
    method: 'get',
    params: {}
  })
}

/* 服务商个人 实名/结算卡 修改 */
export const infoUpdate = (row) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/editInfo',
    method: 'post',
    data: row
  })
}

/* 服务商个人 实名/结算卡 取消更改(审核中可取消) */
export const infoCancel = (row) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/cancel',
    method: 'post',
    data: row
  })
}

/* 服务商个人 结算模式 变更(日结/月结) */
export const updateSettlementMode = () => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/updateSettlementMode',
    method: 'post',
    params: {
    }
  })
}

/* 实名信息 新增/修改/详情 */
export const authAdd = (row) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/submit',
    method: 'post',
    data: row
  })
}

export const authUpdate = (row) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/submit',
    method: 'post',
    data: row
  })
}

export const authUpdateV2 = (row) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/submitV2',
    method: 'post',
    data: row
  })
}

export const getAuthDetail = (userNo) => {
  return request({
    url: '/api/rb-service/service/authExamine/auth_examine/detail',
    method: 'get',
    params: {
      userNo
    }
  })
}

/* 结算卡信息 新增/修改/详情 */
export const bankAdd = (row) => {
  return request({
    url: '/api/rb-service/service/bankExamine/bank_examine/submit',
    method: 'post',
    data: row
  })
}

export const bankUpdate = (row) => {
  return request({
    url: '/api/rb-service/service/bankExamine/bank_examine/submit',
    method: 'post',
    data: row
  })
}

export const getBankDetail = (userNo) => {
  return request({
    url: '/api/rb-service/service/bankExamine/bank_examine/detail',
    method: 'get',
    params: {
      userNo
    }
  })
}

/* 支付通道信息 新增/修改/列表/已分配 */
export const aisleAdd = (row) => {
  return request({
    url: '/api/rb-service/service/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

export const aisleUpdate = (row) => {
  return request({
    url: '/api/rb-service/service/aisleOem/aisle_oem/submit',
    method: 'post',
    data: row
  })
}

export const getAisleOemList = (current, size, userNo) => {
  return request({
    url: '/api/rb-service/service/aisleOem/aisle_oem/list',
    method: 'get',
    params: {
      userNo,
      current,
      size
    }
  })
}

/* 政策分润配置信息 新增/修改 */
export const policyAdd = (row) => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/addPolicy',
    method: 'post',
    data: row
  })
}

export const policyUpdate = (row) => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/addPolicyV3',
    method: 'post',
    data: row
  })
}

export const policyUpdateAll = (row) => {
  return request({
    // url: '/api/rb-service/service/aisleOem/aisle_oem/submitPolicy',
    url: '/api/rb-service/service/oempolicy/oem_policy/addPolicyV2',
    method: 'post',
    data: row
  })
}

/* 模板政策列表 */
export const templatePolicyList = () => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/templateList',
    method: 'get',
  })
}

/* 模板政策一键填入赋值 123*/
export const templatePolicyDetail = (polNo, userNo, userType, id, aisleCode) => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/templateDetail',
    method: 'get',
    params: {
      polNo,
      userNo,
      userType,
      id,
      aisleCode
    }
  })
}

/* 通道政策详情 */
/* export const getPolicyDetail = (userNo, userType, aisleCode) => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/policyDetail',
    method: 'get',
    params: {
      userNo,
      userType,
      aisleCode
    }
  })
} */
export const getPolicyDetail = (row) => {
  return request({
    // url: '/api/rb-service/service/oempolicy/oem_policy/policyDetail',
    url: '/api/rb-service/service/oempolicy/oem_policy/policyDetailV2',
    method: 'POST',
    data: row
  })
}

/* 机构政策详情 */
/* 通道政策详情 服务商政策 */
export const servicePolicyDetail = (row) => {
  return request({
    url: '/api/rb-service/service/oempolicy/oem_policy/orgPolicyDetailV2',
    method: 'POST',
    data: row
  })
}

/* 获取当前登录人的代理商信息 */
export const getServiceInfo = () => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/info',
    method: 'get',
    params: {}
  })
}

/* 完成项 更改审核状态 */
export const getFinish = (userNo) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/finish',
    method: 'post',
    params: {
      userNo
    }
  })
}

/* 新增政策模板详情 */
export const getDetailTemplate = (aisleCode) => {
  return request({
    // url: '/api/rb-service/service/oempolicy/oem_policy/policyDetailTemplate',
    url: '/api/rb-service/service/oempolicy/oem_policy/policyTemplateFrame',
    method: 'get',
    params: {
      aisleCode
    }
  })
}

/* 服务商 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-service/service/serviceinfo/service_info/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 服务商 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-service/service/serviceinfo/service_info/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 发送短信修改密码 */
export const getUpdatePwdBySms = (userNo) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/updatePwdBySms',
    method: 'get',
    params: {
      userNo
    }
  })
}

/* 直接修改密码 */
export const getUpdatePwd = (userNo, pwd) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/updatePwd',
    method: 'post',
    params: {
      userNo,
      pwd
    }
  })
}

/* 云闪付费率 */
export const getThirdStepAttach = (id) => {
  return request({
    url: '/api/rb-service/service/incoming/incoming/thirdStepAttach',
    method: 'get',
    params: {
      id
    }
  })
}

/* 云闪付费率 */
export const getThirdStepAttachPlus = (id) => {
  return request({
    url: '/api/rb-service/service/incomingbasic/incoming_basic/thirdStepAttach',
    method: 'get',
    params: {
      id
    }
  })
}

/* 查商户的服务商列表 */
export const getchildServiceList = (current, size, params) => {
  return request({
    url: '/api/rb-service/service/serviceinfo/service_info/childServiceList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}